// 
import request from '@/utils/request'
// 一级分类的接口函数
// get /admin/product/getCategory1

export const reqGetCategory1=()=>request({url:'/admin/product/getCategory1', method: 'GET'})
// 二级分类的接口函数
// get /admin/product/getCategory2

export const reqGetCategory2=(category1Id)=>request({url:`/admin/product/getCategory2/${category1Id}`, method: 'GET'})
// 三级分类的接口函数
// get /admin/product/getCategory3

export const reqGetCategory3=(category2Id)=>request({url:`/admin/product/getCategory3/${category2Id}`, method: 'GET'})

// 获取品牌属性的接口函数
// /admin/product/attrInfoList/{category1Id}/{category2Id}/{category3Id} get

export const reqAttrList=(category1Id, category2Id, category3Id)=>request({url:`/admin/product/attrInfoList/${category1Id}/${category2Id}/${category3Id}`,method: 'GET'})


// 新增属性或者修改属性的接口函数
export const reqAddOrUpdateAttr=(data)=>{
    if (data.id) {
        return request({url:'/admin/product/saveAttrInfo', method: 'post',data})
    }else{
        return request({url:"admin/product/saveAttrInfo", method: 'post',data})
    }
}

// 删除属性的接口
//  /admin/product/deleteAttr/{attrId} delete

export const reqDeleteAttr=(attrId)=>request({url:`/admin/product/deleteAttr/${attrId}`, method: 'delete'})